﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace IT_Pro.Class
{
    class NV_PhongBan
    {
        private int _maPhong;

        public int MaPhong
        {
            get { return _maPhong; }
            set { _maPhong = value; }
        }


        private string _tenPhongBan;

        public string TenPhongBan
        {
            get { return _tenPhongBan; }
            set { _tenPhongBan = value; }
        }

        public static DataTable HienThiDsPhong()
        {
            string strSQL = "select * from NV_PhongBan";
            return DataServices.ExecQuery(strSQL);
        }

        public static bool ThemPhong(NV_PhongBan _phong)
        {
            string strSQL = "insert into NV_PhongBan (TenPhong) values (N'"+_phong.TenPhongBan+"')";
             DataServices.ExecNonQuery(strSQL);
             return true;
        }

        public static bool CapNhatPhong(NV_PhongBan _phong)
        {
            string strSQL = "update NV_PhongBan set TenPhong=N'" + _phong.TenPhongBan + "' where MaPhong='" + _phong .MaPhong+ "'";
            DataServices.ExecNonQuery(strSQL);
            return true;
        }

        public static bool XoaPhong(string _maPhong)
        {
            string strSQL = "delete NV_PhongBan where MaPhong='" + _maPhong + "'";
            DataServices.ExecNonQuery(strSQL);
            return true;
        }
    }
}
